import request from '@/config/axios'

export interface SysWordVO {
  id: number
  word: string
  replaceWord: string
  sort: number
  hitCount: number
  dictType: string
}

export interface SysWordPageReqVO extends PageParam {
  word?: string
  replaceWord?: string
  sort?: number
  hitCount?: number
  dictType?: string
  createTime?: Date[]
}

export interface SysWordExcelReqVO {
  word?: string
  replaceWord?: string
  sort?: number
  hitCount?: number
  dictType?: string
  createTime?: Date[]
}

// 查询词汇管理列表
export const getSysWordPageApi = async (params: SysWordPageReqVO) => {
  return await request.get({ url: '/cms/sys-word/page', params })
}

// 查询词汇管理详情
export const getSysWordApi = async (id: number) => {
  return await request.get({ url: '/cms/sys-word/get?id=' + id })
}

// 新增词汇管理
export const createSysWordApi = async (data: SysWordVO) => {
  return await request.post({ url: '/cms/sys-word/create', data })
}

// 修改词汇管理
export const updateSysWordApi = async (data: SysWordVO) => {
  return await request.put({ url: '/cms/sys-word/update', data })
}

// 删除词汇管理
export const deleteSysWordApi = async (id: number) => {
  return await request.delete({ url: '/cms/sys-word/delete?id=' + id })
}

// 导出词汇管理 Excel
export const exportSysWordApi = async (params: SysWordExcelReqVO) => {
  return await request.download({ url: '/cms/sys-word/export-excel', params })
}

// 下载导入模板
export const importSysWordTemplateApi = () => {
  return request.download({ url: '/cms/sys-word/get-import-template' })
}

// 查询词汇的易错词列表
export const checkEasyErrorWordApi = async (params) => {
  return await request.get({ url: '/cms/sys-word/validate-easyerrorword', params })
}
